<#include "/ftl/front/common/_layout.html"/>
<@html title="JFinal社区 - 发布话题" description="JFinal社区 - 发布话题" sidebar_create_info="show">
<div class="jf_panel">
    <div class="jf_header">
        <ul class="jf_breadcrumb">
            <li><a href="${baseUrl!}/">首页</a></li>
            <li class="active">发布话题</li>
        </ul>
    </div>
    <div class="jf_inner" style="line-height: 0em;">
        <form id="create_form" action="${baseUrl!}/topic/save" method="post">
            <select name="sid" id="sid" class="form-control" style="width: 20%; margin-bottom: 5px;">
                <#list sections as section>
                    <option value="${section.id}">${section.name}</option>
                </#list>
            </select>
            <input type="text" placeholder="标题字数10字以上" id="title" name="title" class="form-control" style="margin-bottom: 5px;"/>
            <input type="text" placeholder="原文地址（原创可不写）" id="original_url" name="original_url" class="form-control"/>
            <textarea style="height: 450px; margin: 5px 0px 5px 0px;" name="content" id="content"></textarea>
            <input type="submit" value="提交" class="btn btn-primary">
        </form>
    </div>
</div>
<script type="text/javascript">
    var ue = UE.getEditor("content");
    $(function(){
        $("#create_form").submit(function () {
            if($("#title").val().trim().length < 10) {
                alert("标题字数10字以上");
                $("#title").focus();
                return false;
            } else if(ue.getContent() == "") {
                alert("内容不能为空");
                return false;
            }
            return true;
        });
    });
</script>
</@html>